All Questions
Tagged with shellshell-script
2,433 questions
-4votes
0answers
52views
Creating in Linux files in GB or MB range by various random size by read a file [closed]
In Linux in Bash i have this script (thanks to Ed Morton) . $ cat ./tst.sh #!/usr/bin/env bash while read -r idx sfx size; do echo fallocate "file${idx}.${sfx}" "$size" done &...
-2votes
1answer
111views
Creating in Linux files in GB or MB range by various size by read a file [closed]
In Linux with Bash, there is the File numbers_in_one_line. In this file there is only one line with several numbers, all separated by spaces. These numbers are the value in bytes for creating files ...
0votes
1answer
104views
How to compare output of a program with a reference value in a shell script?
I have my own implementation of a Redis server which I'd like to test through a shell script. The general idea is to feed it with some commands through nc, and since nc prints the output of my program ...
0votes
2answers
97views
How to redirect output from a program that waits for input
Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables: #!/bin/zsh pamtester login $user authenticate <&...
0votes
2answers
87views
how do i use pv in a script that has a seq for loop
I have a script that has a for loop in it that runs a specific amount of times, and I was wondering if it is possible to implement the pv command in my script to add a progress bar. Here is my code: ...
1vote
1answer
66views
How can a bash script determine how it was started? [duplicate]
I am running various scripts on Debian 12.X currently with the following bash: GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) I have the following methods/options to execute the script. ...
0votes
5answers
128views
Move/mark files and the associated-part too
There is a folder with many files in it: 112.mkv 123.md5 123.mkv 221.mkv 467.mkv aa1.mkv abc.md5 abc.mkv bbc.mkv dde.md5 dde.mkv ggh.mkv .... xxy.md5 xxy.mkv xxz.mkv How can I move .md5 files and the ...
2votes
1answer
895views
What do programs use to read their environment?
I'm on Fedora, where all preinstalled shells apparently support bashisms: bash --posix does, and even sh. Still, when I used this function, pathprepend () { if [[ ":$PATH:" != *":$1:...
0votes
0answers
33views
Can't use combination of parentheses and variables in scripts [duplicate]
I have problems with replacing parentheses in combination with variables, in ssh. For instance, replacing (hello123blablabla) with (hello). So, it replaces all together, and parentheses as well, at ...
0votes
1answer
311views
How to use docker exec to execute a shell script with an argument in a container?
I have a shell script on my host, which is calling another script to run inside the container. Here is a simple case that works fine: host_script.sh #!/bin/sh results=$(docker exec mycontainer "....
1vote
1answer
100views
Open pdf files by terminal with fzf and fd
with the following command line, which I turned into an alias, I would like to open the pdf files from my terminal. alias pdfLoad="fd . '$HOME/OneDrive/DBCalibre' -t f -e pdf | fzf | xargs -0 -...
4votes
1answer
268views
How to detect if headphones are plugged in for a shell script?
I'm writing my own custom status for i3/Sway that shows a volume indicator, and I've run into a snag. I'd like to know if there is a standard way, using standard Linux tools--maybe ALSA or sysfs--to ...
0votes
1answer
27views
How to start tree of applications with dependencies
I need to be able to automatically start a requested application. Every application can have pre requisite applications that need to be started before it starts, and an application can itself be a pre-...
2votes
1answer
328views
Can one execute a function in background from a function that is already running in background?
Considering the following script: if [[ -z "$DOWNLOAD_ONLY" || "$DOWNLOAD_ONLY" = *conditions* ]]; then function get_condition { curl -s "https://conditions.com" | ...
0votes
1answer
33views
Symlinks with data inside directory
I'm using this symlinks ln -s "$REPO_DIR/src/packages/my-project/out" "$OUTPUT_PATH" Currently, my OUTPUT_PATH only has only 1 folder out How can I make my OUTPUT_PATH has all the ...